package com.mantru.iotpot.setting.Adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.mantru.iotpot.DateClass.Set_Seasoning_Calibration_Date;
import com.mantru.iotpot.R;

import java.util.List;

public class SetSeasoningCalibrationAdapter extends RecyclerView.Adapter<SetSeasoningCalibrationAdapter.ViewHolder>{
    private List<Set_Seasoning_Calibration_Date> list;
    @NonNull
    @Override
    public SetSeasoningCalibrationAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_set_seasoning_calibration, parent, false);
        return new SetSeasoningCalibrationAdapter.ViewHolder(view);
    }

    public SetSeasoningCalibrationAdapter(List<Set_Seasoning_Calibration_Date> dates) {
        this.list = dates;
    }
    @Override
    public void onBindViewHolder(@NonNull SetSeasoningCalibrationAdapter.ViewHolder holder, int position) {
        Set_Seasoning_Calibration_Date setDate = list.get(position);
        holder.name1.setText(setDate.getTitle1());
        holder.name2.setText(setDate.getTitle2());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder{
        private final TextView name1;
        private final TextView name2;
        public ViewHolder(View view){
            super(view);
            name1 = view.findViewById(R.id.adapter_set_seasoning_calibration_name1);
            name2 = view.findViewById(R.id.adapter_set_seasoning_calibration_name2);
        }
    }
}
